How Do I Show a Description Panel?
The WPF Property Grid doesn’t include a description panel within the control, because this would make it harder to style the appearance or customize the layout. Instead, you can create your own panel, styled and placed as you wish, and data bind it to the WPF Property Grid to show the description of the selected item.
To do this:
- In your resources section, create an instance of RowToDescriptionConverter:
CopyXML
<ms:RowToDescriptionConverter x:Key="RowToDescription" />
- Create the panel where you want to display the description, including one or more text elements to display the description:
CopyXML
<StackPanel> <TextBlock FontWeight="Bold" /> <TextBlock /> </StackPanel>
- Data bind the text elements to the SelectedGridItem of the property grid, using the RowToDescriptionConverter to extract the description:
CopyXML
<StackPanel Background="LightGray"> <TextBlock Text="{Binding SelectedGridItem.Node.HumanName, ElementName=myGrid}" FontWeight="Bold" /> <TextBlock Text="{Binding SelectedGridItem, ElementName=myGrid, Converter={StaticResource RowToDescription}" /> </StackPanel>
For sample code, see step 8 of the Customization Walkthrough. The sample code also shows some basic visual styling and dynamic behavior.